package com.quickdv.until;

import android.content.Context;

import java.io.File;
import java.io.FileOutputStream;
import java.util.Properties;

/**
 * Created by Administrator on 2015/11/24.
 */
public class ReadUntil {
    //保存配置文件
    public boolean saveConfig(Context context, String file, Properties properties) {
        try {
            File fil=new File(file);
            if(!fil.exists())
                fil.createNewFile();
            FileOutputStream s = new FileOutputStream(fil);
            properties.store(s, "");
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }

    public Properties loadConfig(Context context,String name){
        Properties properties = new Properties();
        try {
            properties.load(context.getResources().getAssets().open(name));
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
        return properties;
    }
}
